import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询用户列表
export function checkidentity(query) {
  return request({
    url: 'https://tools-test.shenzhoutongbao.cn/information/identity/verify/identity/element/two',
    method: 'post',
    params: query
  })
}
// 新增用户查询用户详细
export function getidentityOption() {
  return request({
    url: '/tax/system/identity/option',
    method: 'get'
  })
}
// 修改查询用户详细
export function getidentity(identityId) {
  return request({
    url: '/tax/system/identity/' + praseStrEmpty(identityId),
    method: 'get'
  })
}

// 新增用户
export function addidentity(data) {
  return request({
    url: '/tax/system/identity/save',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateidentity(data) {
  return request({
    url: '/tax/system/identity/update',
    method: 'put',
    data: data
  })
}

// 删除用户
export function delidentity(id) {
  return request({
    url: '/tax/system/identity/delete/' + id,
    method: 'delete'
  })
}

// 导出用户
export function exportidentity(query) {
  return request({
    url: '/system/identity/export',
    method: 'get',
    params: query
  })
}

// 用户密码重置
export function resetidentityPwd(identityName,oldPassword,newPassword,againPassword) {
  const data = {
    identityName,
    oldPassword,
    newPassword,
    againPassword
  }
  return request({
    url: '/account/supervisor/updatePassword',
    method: 'post',
    data: data
  })
}

// 用户状态修改
export function changeidentityStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/tax/system/identity/change/status',
    method: 'put',
    data: data
  })
}

// 查询用户个人信息
export function getidentityProfile() {
  return request({
    url: '/system/identity/profile',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateidentityProfile(data) {
  return request({
    url: '/system/identity/profile',
    method: 'put',
    data: data
  })
}

// 用户密码重置
export function updateidentityPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/identity/profile/updatePwd',
    method: 'put',
    params: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/system/identity/profile/avatar',
    method: 'post',
    data: data
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/system/identity/importTemplate',
    method: 'get'
  })
}
